home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 60 / IOPROG_60.ISO / soft / c++ / gsl-1.1.1-setup.exe / {app} / src / vector / test.c < prev    next >
Encoding:
C/C++ Source or Header  |  2002-04-18  |  5.2 KB  |  231 lines

  1. /* vector/test.c
  2.  * 
  3.  * Copyright (C) 1996, 1997, 1998, 1999, 2000 Gerard Jungman, Brian Gough
  4.  * 
  5.  * This program is free software; you can redistribute it and/or modify
  6.  * it under the terms of the GNU General Public License as published by
  7.  * the Free Software Foundation; either version 2 of the License, or (at
  8.  * your option) any later version.
  9.  * 
  10.  * This program is distributed in the hope that it will be useful, but
  11.  * WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.  * General Public License for more details.
  14.  * 
  15.  * You should have received a copy of the GNU General Public License
  16.  * along with this program; if not, write to the Free Software
  17.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  */
  19.  
  20. #include <config.h>
  21.  
  22. #ifdef GSL_RANGE_CHECK_OFF
  23. #undef GSL_RANGE_CHECK_OFF
  24. #endif
  25.  
  26. #include <stdlib.h>
  27. #include <fcntl.h>
  28. #include <stdio.h>
  29. #include <gsl/gsl_math.h>
  30. #include <gsl/gsl_vector.h>
  31. #include <gsl/gsl_test.h>
  32. #include <gsl/gsl_ieee_utils.h>
  33.  
  34. int status = 0;
  35.  
  36. #ifndef DESC
  37. #define DESC ""
  38. #endif
  39.  
  40. #define N 1027
  41.  
  42. #define BASE_GSL_COMPLEX_LONG
  43. #include "templates_on.h"
  44. #include "test_complex_source.c"
  45. #ifdef HAVE_PRINTF_LONGDOUBLE
  46. #include "test_complex_io.c"
  47. #endif
  48. #include "templates_off.h"
  49. #undef  BASE_GSL_COMPLEX_LONG
  50.  
  51.  
  52. #define BASE_GSL_COMPLEX
  53. #include "templates_on.h"
  54. #include "test_complex_source.c"
  55. #include "test_complex_io.c"
  56. #include "templates_off.h"
  57. #undef  BASE_GSL_COMPLEX
  58.  
  59. #define BASE_GSL_COMPLEX_FLOAT
  60. #include "templates_on.h"
  61. #include "test_complex_source.c"
  62. #include "test_complex_io.c"
  63. #include "templates_off.h"
  64. #undef  BASE_GSL_COMPLEX_FLOAT
  65.  
  66. #define BASE_LONG_DOUBLE
  67. #include "templates_on.h"
  68. #include "test_source.c"
  69. #ifdef HAVE_PRINTF_LONGDOUBLE
  70. #include "test_io.c"
  71. #endif
  72. #include "templates_off.h"
  73. #undef  BASE_LONG_DOUBLE
  74.  
  75. #define BASE_DOUBLE
  76. #include "templates_on.h"
  77. #include "test_source.c"
  78. #include "test_io.c"
  79. #include "templates_off.h"
  80. #undef  BASE_DOUBLE
  81.  
  82. #define BASE_FLOAT
  83. #include "templates_on.h"
  84. #include "test_source.c"
  85. #include "test_io.c"
  86. #include "templates_off.h"
  87. #undef  BASE_FLOAT
  88.  
  89. #define BASE_ULONG
  90. #include "templates_on.h"
  91. #include "test_source.c"
  92. #include "test_io.c"
  93. #include "templates_off.h"
  94. #undef  BASE_ULONG
  95.  
  96. #define BASE_LONG
  97. #include "templates_on.h"
  98. #include "test_source.c"
  99. #include "test_io.c"
  100. #include "templates_off.h"
  101. #undef  BASE_LONG
  102.  
  103. #define BASE_UINT
  104. #include "templates_on.h"
  105. #include "test_source.c"
  106. #include "test_io.c"
  107. #include "templates_off.h"
  108. #undef  BASE_UINT
  109.  
  110. #define BASE_INT
  111. #include "templates_on.h"
  112. #include "test_source.c"
  113. #include "test_io.c"
  114. #include "templates_off.h"
  115. #undef  BASE_INT
  116.  
  117. #define BASE_USHORT
  118. #include "templates_on.h"
  119. #include "test_source.c"
  120. #include "test_io.c"
  121. #include "templates_off.h"
  122. #undef  BASE_USHORT
  123.  
  124. #define BASE_SHORT
  125. #include "templates_on.h"
  126. #include "test_source.c"
  127. #include "test_io.c"
  128. #include "templates_off.h"
  129. #undef  BASE_SHORT
  130.  
  131. #define BASE_UCHAR
  132. #include "templates_on.h"
  133. #include "test_source.c"
  134. #include "test_io.c"
  135. #include "templates_off.h"
  136. #undef  BASE_UCHAR
  137.  
  138. #define BASE_CHAR
  139. #include "templates_on.h"
  140. #include "test_source.c"
  141. #include "test_io.c"
  142. #include "templates_off.h"
  143. #undef  BASE_CHAR
  144.  
  145. void my_error_handler (const char *reason, const char *file,
  146.                int line, int err);
  147.  
  148. int
  149. main (void)
  150. {
  151.   gsl_ieee_env_setup ();
  152.  
  153.   test_func ();
  154.   test_float_func ();
  155.   test_long_double_func ();
  156.   test_ulong_func ();
  157.   test_long_func ();
  158.   test_uint_func ();
  159.   test_int_func ();
  160.   test_ushort_func ();
  161.   test_short_func ();
  162.   test_uchar_func ();
  163.   test_char_func ();
  164.   test_complex_func ();
  165.   test_complex_float_func ();
  166.   test_complex_long_double_func ();
  167.  
  168.   test_text ();
  169.   test_float_text ();
  170. #ifdef HAVE_PRINTF_LONGDOUBLE
  171.   test_long_double_text ();
  172. #endif
  173.   test_ulong_text ();
  174.   test_long_text ();
  175.   test_uint_text ();
  176.   test_int_text ();
  177.   test_ushort_text ();
  178.   test_short_text ();
  179.   test_uchar_text ();
  180.   test_char_text ();
  181.   test_complex_text ();
  182.   test_complex_float_text ();
  183. #ifdef HAVE_PRINTF_LONGDOUBLE
  184.   test_complex_long_double_text ();
  185. #endif
  186.  
  187.   test_binary ();
  188.   test_float_binary ();
  189.   test_long_double_binary ();
  190.   test_ulong_binary ();
  191.   test_long_binary ();
  192.   test_uint_binary ();
  193.   test_int_binary ();
  194.   test_ushort_binary ();
  195.   test_short_binary ();
  196.   test_uchar_binary ();
  197.   test_char_binary ();
  198.   test_complex_binary ();
  199.   test_complex_float_binary ();
  200.   test_complex_long_double_binary ();
  201.  
  202.   gsl_warnings_off = 1;
  203.  
  204.   gsl_set_error_handler (&my_error_handler);
  205.  
  206.   test_trap ();
  207.   test_float_trap ();
  208.   test_long_double_trap ();
  209.   test_ulong_trap ();
  210.   test_long_trap ();
  211.   test_uint_trap ();
  212.   test_int_trap ();
  213.   test_ushort_trap ();
  214.   test_short_trap ();
  215.   test_uchar_trap ();
  216.   test_char_trap ();
  217.   test_complex_trap ();
  218.   test_complex_float_trap ();
  219.   test_complex_long_double_trap ();
  220.  
  221.   exit (gsl_test_summary ());
  222. }
  223.  
  224. void
  225. my_error_handler (const char *reason, const char *file, int line, int err)
  226. {
  227.   if (0)
  228.     printf ("(caught [%s:%d: %s (%d)])\n", file, line, reason, err);
  229.   status = 1;
  230. }
  231.